Debugging Services

Windows NT only: WinDbg can be used to debug service applications. The debugging process is the same as for a Win32-based application, but starting and stopping the debug session is slightly different.

{bmc bm4.MRB}        To debug a service

1.   Build the service with debugging information.

2.   Install the service.

3.   Start the service by using either the Services control panel applet or the SC tool in the MSTOOLS\BIN directory.

4.   Open the source files for the service and set any breakpoints.

5.   Attach to the service by choosing Attach from the Run menu or using the .attach command.

 

Exiting WinDbg will terminate the service. The service must be restarted with the Services control panel applet or the SC tool.